<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
FlyUI Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="flyatlas-widget.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>FlyUI</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>flyatlas-widget.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		This script defines a widget for interacting with expression data from flyatlas.
 <BR/><BR/><B>Version: </B>$Revision:538 $ on $Date: 2008-08-27 09:08:41 +0100 (Wed, 27 Aug 2008) $ by $Author: aliman $
 <BR/><BR/><B>Requires:</B><UL>- <a href="../../flyui/util.html#">flyui.util</a><BR/>- <a href="../../flyui/sparql/Service.html#">flyui.sparql.Service</a><BR/>- <a href="../../flyui/flyatlas/Service.html#">flyui.flyatlas.Service</a><BR/>- YAHOO.util.Connect<BR/>- jQuery
 For license terms see http://flyui.googlecode.com</UL><B>Author:</B> <a href="http://purl.org/net/aliman">Alistair Miles</a>
 <BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="flyui/flyatlas/Widget.html">flyui.flyatlas.Widget</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="flyui/flyatlas/Widget/Controller.html">flyui.flyatlas.Widget.Controller</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="flyui/flyatlas/Widget/DefaultRenderer.html">flyui.flyatlas.Widget.DefaultRenderer</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/**
 * <span class="attrib">@fileoverview</span>
 * This script defines a widget for interacting with expression data from flyatlas.
 * <span class="attrib">@author</span> &lt;a href="http://purl.org/net/aliman"&gt;Alistair Miles&lt;/a&gt;
 * <span class="attrib">@version</span> $Revision:538 $ on $Date: 2008-08-27 09:08:41 +0100 (Wed, 27 Aug 2008) $ by $Author: aliman $
 * <span class="attrib">@requires</span> flyui.util
 * <span class="attrib">@requires</span> flyui.sparql.Service
 * <span class="attrib">@requires</span> flyui.flyatlas.Service
 * <span class="attrib">@requires</span> YAHOO.util.Connect
 * <span class="attrib">@requires</span> jQuery
 * For license terms see http://flyui.googlecode.com
 */</span>


<span class="comment">/*
 * ----------------------------------------------------------------
 *                             WIDGET
 * ----------------------------------------------------------------
 */</span>


<span class="comment">/**
 * <span class="attrib">@class</span>
 * <span class="attrib">@param</span> {flyui.flyatlas.Service} service
 * <span class="attrib">@param</span> {flyui.flyatlas.Widget.DefaultRenderer} renderer
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget = <span class="reserved">function</span>( service, renderer ) {

    <span class="comment">/** 
     * <span class="attrib">@private</span> 
     * <span class="attrib">@type</span> flyui.flyatlas.Widget.Controller
     */</span>
    <span class="reserved">this</span>._controller = null;
    
    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.mvcutils.GenericModel2
     */</span> 
    <span class="reserved">this</span>._model = null;
    
    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.flyatlas.Widget.DefaultRenderer
     */</span>
    <span class="reserved">this</span>._renderer = null;
    
    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.flyatlas.Service
     */</span>
    <span class="reserved">this</span>._service = null;

    <span class="comment">// do initialisation</span>
    <span class="reserved">this</span>._init(service, renderer);
    
};

<span class="comment">/**
 * Do initialisation of a widget.
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {flyui.flyatlas.Service} service
 * <span class="attrib">@param</span> {flyui.flyatlas.Widget.DefaultRenderer} renderer
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.<span class="reserved">prototype</span>._init = <span class="reserved">function</span>(service, renderer) {
    try {

        <span class="reserved">this</span>._service = service;
        <span class="reserved">this</span>._renderer = renderer;
        
        <span class="comment">// create a model</span>
        <span class="reserved">this</span>._model = new flyui.mvcutils.GenericModel2();
        <span class="reserved">this</span>._model.setDefinition(flyui.flyatlas.Widget.modelDefinition);
        
        <span class="comment">// instantiate the controller</span>
        <span class="reserved">this</span>._controller = new flyui.flyatlas.Widget.Controller(<span class="reserved">this</span>._model, service, <span class="reserved">this</span>);
        
        <span class="comment">// connect the renderer to the model</span>
        <span class="reserved">this</span>._renderer.connect(<span class="reserved">this</span>._model);
        
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.prototype._init"</span>, error);
    }
};


<span class="comment">/**
 * <span class="attrib">@param</span> {String} id affy probe id
 */</span>
flyui.flyatlas.Widget.<span class="reserved">prototype</span>.getAssaysByAffyProbeId = <span class="reserved">function</span>( id ) {
    try {
        <span class="comment">// pass through to controller</span>
        <span class="reserved">this</span>._controller.getAssaysByAffyProbeId(id);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.prototype.getAssaysByAffyProbeId"</span>, error);
    }
}


<span class="comment">/**
 * <span class="attrib">@param</span> {flyui.flybase.Gene} gene
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.<span class="reserved">prototype</span>.getAssaysByGene = <span class="reserved">function</span>( gene ) {
    try {
    	<span class="comment">// pass through to controller</span>
    	<span class="reserved">this</span>._controller.getAssaysByGene(gene);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.prototype.getAssaysByGene"</span>, error);
    }
}


<span class="comment">/*
 * ----------------------------------------------------------------
 *                             CONTROLLER
 * ----------------------------------------------------------------
 */</span>


<span class="comment">/**
 * <span class="attrib">@class</span>
 * <span class="attrib">@param</span> {flyui.mvcutils.GenericModel2} model
 * <span class="attrib">@param</span> {flyui.flyatlas.Service} service
 * <span class="attrib">@param</span> {flyui.flyatlas.Widget} controllee
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.Controller = <span class="reserved">function</span>( model, service, controllee ) {

    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.mvcutils.GenericModel2
     */</span>
    <span class="reserved">this</span>._model = null;
    
    
    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.flyatlas.Service
     */</span>
    <span class="reserved">this</span>._service = null;
    
    
    <span class="comment">/**
     * <span class="attrib">@private</span>
     * <span class="attrib">@type</span> flyui.flyatlas.Widget
     */</span>
    <span class="reserved">this</span>._controllee = null;

    <span class="comment">// do initialisation</span>
    <span class="reserved">this</span>._init(model, service, controllee);
};


<span class="comment">/**
 * <span class="attrib">@param</span> {flyui.mvcutils.GenericModel2} model
 * <span class="attrib">@param</span> {flyui.flyatlas.Service} service
 * <span class="attrib">@param</span> {flyui.flyatlas.Widget} controllee
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>._init = <span class="reserved">function</span>( model, service, controllee ) {
    <span class="reserved">this</span>._model = model;
    <span class="reserved">this</span>._service = service;
    <span class="reserved">this</span>._controllee = controllee;
};


<span class="comment">/**
 * <span class="attrib">@param</span> {String} affyId
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>.getAssaysByAffyProbeId = <span class="reserved">function</span>( affyId ) {
    try {
        <span class="comment">// pass through to private implementation</span>
        <span class="reserved">this</span>._getAssaysByAffyProbeId(affyId, <span class="reserved">this</span>._getAssaysSuccess(), <span class="reserved">this</span>._getAssaysFailure());
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.Controller.prototype.getAssaysByAffyProbeId"</span>, error);
    }
};


<span class="comment">/**
 * <span class="attrib">@param</span> {String} flybaseId
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>.getAssaysByGene = <span class="reserved">function</span>( gene ) {
    try {
        <span class="comment">// pass through to private implementation</span>
        <span class="reserved">this</span>._getAssaysByGene(gene, <span class="reserved">this</span>._getAssaysSuccess(), <span class="reserved">this</span>._getAssaysFailure());
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.Controller.prototype.getAssaysByGene"</span>, error);
    }
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {String} affyId
 * <span class="attrib">@param</span> {Function} success
 * <span class="attrib">@param</span> {Function} failure
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>._getAssaysByAffyProbeId = <span class="reserved">function</span>( affyId, success, failure ) {
    try {
        flyui.debug(<span class="literal">"in _getAssaysByProbeId, affyId: "</span>+affyId);
        <span class="reserved">this</span>._model.set(<span class="literal">"RESULTS"</span>, null);
        <span class="reserved">this</span>._model.set(<span class="literal">"QUERY"</span>, affyId);
        <span class="reserved">this</span>._model.set(<span class="literal">"MODE"</span>, <span class="literal">"PROBE"</span>);
        <span class="reserved">this</span>._model.set(<span class="literal">"STATE"</span>, <span class="literal">"PENDING"</span>);
        <span class="reserved">this</span>._service.getAssaysByAffyProbeId(affyId, success, failure);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.Controller.prototype._getAssaysByAffyProbeId"</span>, error);
    }
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {String} flybaseId
 * <span class="attrib">@param</span> {Function} success
 * <span class="attrib">@param</span> {Function} failure
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>._getAssaysByGene = <span class="reserved">function</span>( gene, success, failure ) {
    try {
        flyui.debug(<span class="literal">"in _getAssaysByGene, flybaseId: "</span>+gene.flybaseId);
        <span class="reserved">this</span>._model.set(<span class="literal">"RESULTS"</span>, null);
        <span class="reserved">this</span>._model.set(<span class="literal">"QUERY"</span>, gene);
        <span class="reserved">this</span>._model.set(<span class="literal">"MODE"</span>, <span class="literal">"GENE"</span>);
        <span class="reserved">this</span>._model.set(<span class="literal">"STATE"</span>, <span class="literal">"PENDING"</span>);
        <span class="reserved">this</span>._service.getAssaysByFlybaseGeneId(gene.flybaseID, success, failure);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.Controller.prototype._getAssaysByGene"</span>, error);
    }
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@type</span> Function
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>._getAssaysSuccess = <span class="reserved">function</span>() {
    var self = <span class="reserved">this</span>;
    <span class="reserved">return</span> <span class="reserved">function</span>( groups ) {
        try {
            self._model.set(<span class="literal">"RESULTS"</span>, groups);
            self._model.set(<span class="literal">"STATE"</span>, <span class="literal">"READY"</span>);
        } catch (error) {
            throw new flyui.UnexpectedException(<span class="literal">"anonymous callback (from flyui.flyatlas.Widget.Controller.prototype._getAssaysSuccess)"</span>, error);
        }
    }
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@type</span> Function
 */</span>
flyui.flyatlas.Widget.Controller.<span class="reserved">prototype</span>._getAssaysFailure = <span class="reserved">function</span>() {
    var self = <span class="reserved">this</span>;
    <span class="reserved">return</span> <span class="reserved">function</span>( response ) {
        try {
            flyui.err(<span class="literal">"request failed: "</span>+response.status+<span class="literal">" "</span>+response.statusText);
            self._model.set(<span class="literal">"MESSAGE"</span>, <span class="literal">"there was an error retrieving data from the server, see the logs for more info"</span>);
            self._model.set(<span class="literal">"STATE"</span>, <span class="literal">"SERVERERROR"</span>);
        } catch (error) {
            throw new flyui.UnexpectedException(<span class="literal">"anonymous callback (from flyui.flyatlas.Widget.Controller.prototype._getAssaysFailure)"</span>, error);
        }
    }
};


<span class="comment">/** 
 * <span class="attrib">@type</span> Object
 */</span>
flyui.flyatlas.Widget.modelDefinition = {

    properties : [ <span class="literal">"STATE"</span>, <span class="literal">"RESULTS"</span>, <span class="literal">"MESSAGE"</span>, <span class="literal">"QUERY"</span>, <span class="literal">"MODE"</span> ],
    
    values : {
        <span class="literal">"STATE"</span> : [ <span class="literal">"READY"</span>, <span class="literal">"PENDING"</span>, <span class="literal">"SERVERERROR"</span>, <span class="literal">"UNEXPECTEDERROR"</span> ],
        <span class="literal">"MODE"</span> : [ <span class="literal">"PROBE"</span>, <span class="literal">"GENE"</span> ]
    },
    
    initialize : <span class="reserved">function</span>( data ) {
        data[<span class="literal">"STATE"</span>] = <span class="literal">"READY"</span>;
        data[<span class="literal">"RESULTS"</span>] = null;
        data[<span class="literal">"MESSAGE"</span>] = null;
        data[<span class="literal">"QUERY"</span>] = null;
        data[<span class="literal">"MODE"</span>] = null;
    }

};


<span class="comment">/*
 * ----------------------------------------------------------------
 *                             DEFAULT RENDERER
 * ----------------------------------------------------------------
 */</span>
 
 
<span class="comment">/**
 * <span class="attrib">@class</span>
 */</span>
flyui.flyatlas.Widget.DefaultRenderer = <span class="reserved">function</span>() {

    <span class="comment">/** <span class="attrib">@private</span> */</span>
    <span class="reserved">this</span>._canvas = null;
    
    <span class="comment">/** <span class="attrib">@private</span> */</span>
    <span class="reserved">this</span>._pendingPane = null;
    
    <span class="comment">/** <span class="attrib">@private</span> */</span>
    <span class="reserved">this</span>._resultsPane = null;
    
    <span class="comment">/** <span class="attrib">@private</span> */</span>
    <span class="reserved">this</span>._resultsSummaryPane = null;
    
    <span class="comment">/** <span class="attrib">@private</span> */</span>
    <span class="reserved">this</span>._messagePane = null;
        
};


<span class="comment">/**
 * <span class="attrib">@param</span> {Element} canvas
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>.setCanvas = <span class="reserved">function</span>( canvas ) {
    try {
<span class="comment">//    this._canvas = canvas;</span>
        <span class="reserved">this</span>._canvas = $(canvas);
        <span class="reserved">this</span>._initCanvas();
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype.setCanvas"</span>, error);
    }
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._initCanvas = <span class="reserved">function</span>() {
    try {
        flyui.debug(<span class="literal">"_initCanvas"</span>);
        
        var canvas = <span class="reserved">this</span>._canvas;
        canvas.addClass(<span class="literal">"flyatlasWidget"</span>);
        
        <span class="comment">// setup pending pane</span>
    <span class="comment">//    this._pendingPane = document.createElement("p");</span>
    <span class="comment">//    this._pendingPane.innerHTML = "pending...";</span>
    <span class="comment">//    this._canvas.appendChild(this._pendingPane);</span>
    <span class="comment">//    YAHOO.util.Dom.addClass(this._pendingPane, "pendingPane");</span>
    <span class="comment">//    flyui.mvcutils.hide(this._pendingPane);</span>
        var pp = $(<span class="literal">"&lt;p class='pendingPane'&gt;pending...&lt;/p&gt;"</span>).hide();
        canvas.append(pp);
        <span class="reserved">this</span>._pendingPane = pp;
    
        <span class="comment">// setup results summary pane</span>
    <span class="comment">//    this._resultsSummaryPane = document.createElement("p");</span>
    <span class="comment">//    this._resultsSummaryPane.innerHTML = "this should never be displayed";</span>
    <span class="comment">//    this._canvas.appendChild(this._resultsSummaryPane);</span>
    <span class="comment">//    YAHOO.util.Dom.addClass(this._resultsSummaryPane, "resultsSummaryPane");</span>
    <span class="comment">//    flyui.mvcutils.hide(this._resultsSummaryPane);</span>
        var rsp = $(<span class="literal">"&lt;p class='resultsSummaryPane'&gt;this text should never be displayed&lt;/p&gt;"</span>).hide();
        canvas.append(rsp);
        <span class="reserved">this</span>._resultsSummaryPane = rsp;
        
        <span class="comment">// setup results pane</span>
    <span class="comment">//    this._resultsPane = document.createElement("div");</span>
    <span class="comment">//    this._canvas.appendChild(this._resultsPane);</span>
    <span class="comment">//    YAHOO.util.Dom.addClass(this._resultsPane, "resultsPane");</span>
    <span class="comment">//    flyui.mvcutils.hide(this._resultsPane);</span>
        var rp = $(<span class="literal">"&lt;div class='resultsPane'&gt;&lt;/div&gt;"</span>).hide();
        canvas.append(rp);
        <span class="reserved">this</span>._resultsPane = rp;
    
        <span class="comment">// message pane</span>
    <span class="comment">//    this._messagePane = document.createElement("p");</span>
    <span class="comment">//    this._messagePane.innerHTML = "this should never be displayed";</span>
    <span class="comment">//    this._canvas.appendChild(this._messagePane);</span>
    <span class="comment">//    YAHOO.util.Dom.addClass(this._messagePane, "messagePane");</span>
    <span class="comment">//    flyui.mvcutils.hide(this._messagePane); </span>
        var mp = $(<span class="literal">"&lt;p class='messagePane'&gt;this text should never be displayed&lt;/p&gt;"</span>).hide();
        canvas.append(mp);
        <span class="reserved">this</span>._messagePane = mp;    
        
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._initCanvas"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@param</span> {flyui.mvcutils.GenericModel2} model
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>.connect = <span class="reserved">function</span>( model ) {
    try {
        model.subscribeAll(<span class="reserved">this</span>._onModelChanged, <span class="reserved">this</span>);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype.connect"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onModelChanged = <span class="reserved">function</span>( type, args, self ) {
    try {
        var handlers = {
            <span class="literal">"STATE"</span>:<span class="literal">"_onStateChanged"</span>,
            <span class="literal">"QUERY"</span>:<span class="literal">"_onQueryChanged"</span>,
            <span class="literal">"RESULTS"</span>:<span class="literal">"_onResultsChanged"</span>,
            <span class="literal">"MESSAGE"</span>:<span class="literal">"_onMessageChanged"</span>, 
            <span class="literal">"MODE"</span>:<span class="literal">"_onModeChanged"</span>
        };
        var handler = handlers[type];
        flyui.debug(<span class="literal">"handler: "</span>+handler);
        <span class="comment">// call the handler</span>
        self[handler](args[0], args[1], args[2]);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._onModelChanged"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {String} from
 * <span class="attrib">@param</span> {String} to
 * <span class="attrib">@param</span> {Function} get
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onQueryChanged = <span class="reserved">function</span>( from, to, get ) {
    <span class="comment">// do nothing, we will access the value later</span>
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {String} from
 * <span class="attrib">@param</span> {String} to
 * <span class="attrib">@param</span> {Function} get
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onModeChanged = <span class="reserved">function</span>( from, to, get ) {
    <span class="comment">// do nothing, we will access the value later</span>
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@param</span> {String} from
 * <span class="attrib">@param</span> {String} to
 * <span class="attrib">@param</span> {Function} get
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onStateChanged = <span class="reserved">function</span>( from, to, get ) {
    try {
        <span class="reserved">if</span> ( to == <span class="literal">"PENDING"</span> ) {
            <span class="reserved">this</span>._pendingPane.show();
            <span class="reserved">this</span>._messagePane.empty().hide();
            <span class="reserved">this</span>._resultsSummaryPane.hide();
            <span class="reserved">this</span>._resultsPane.hide();
        }
        <span class="reserved">else</span> <span class="reserved">if</span> ( to == <span class="literal">"READY"</span> ) {
            <span class="reserved">this</span>._pendingPane.hide();
            <span class="reserved">this</span>._messagePane.hide(); <span class="comment">// hide for now, not needed yet</span>
            <span class="reserved">this</span>._resultsSummaryPane.show();
            <span class="reserved">this</span>._resultsPane.show();         
        } 
        <span class="reserved">else</span> <span class="reserved">if</span> ( to == <span class="literal">"SERVERERROR"</span> || to == <span class="literal">"UNEXPECTEDERROR"</span> ) {
            <span class="reserved">this</span>._pendingPane.hide();
            <span class="reserved">this</span>._messagePane.show();
            <span class="reserved">this</span>._resultsSummaryPane.hide();
            <span class="reserved">this</span>._resultsPane.hide();         
        } 
        <span class="reserved">else</span> {
            <span class="comment">// this should never happen</span>
            throw {message:<span class="literal">"invalid state: "</span>+to};
        }
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._onStateChanged"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onResultsChanged = <span class="reserved">function</span>( from, to, get ) {
    try {    
        flyui.debug(<span class="literal">"results changed: "</span>+to);
        
        <span class="reserved">if</span> (to == null) {
            flyui.debug(<span class="literal">"empty results summary pane"</span>);
            <span class="reserved">this</span>._resultsSummaryPane.empty();
            flyui.debug(<span class="literal">"empty results pane"</span>);
            <span class="reserved">this</span>._resultsPane.empty();
        }
        <span class="reserved">else</span> {
    
            var query = get(<span class="literal">"QUERY"</span>); <span class="comment">// fetch from model</span>
            var mode = get(<span class="literal">"MODE"</span>); <span class="comment">// fetch from model</span>
            
            flyui.debug(<span class="literal">"render results summary"</span>);
            <span class="reserved">this</span>._renderResultsSummary(mode, query, to.length);
    
            flyui.debug(<span class="literal">"render results"</span>);
            <span class="reserved">this</span>._renderResults(to);        
            
        }    
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._onResultsChanged"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._onMessageChanged = <span class="reserved">function</span>( from, to, get ) {
    try {
        <span class="reserved">this</span>._messagePane.html(to);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._onMessageChanged"</span>, error);
    }    
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 * Render the results summary pane.
 * <span class="attrib">@param</span> {String} query the user's query
 * <span class="attrib">@param</span> {Number} count number of results found
 * <span class="attrib">@throws</span> flyui.UnexpectedException
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._renderResultsSummary = <span class="reserved">function</span>( mode, query, count ) {
    try {
        var content = <span class="literal">"showing "</span>;
        content += count;
        content += <span class="literal">" matching probe"</span>;
        content += (count == 0 || count &gt; 1) ? <span class="literal">"s "</span> : <span class="literal">" "</span>;
        content += <span class="literal">"from &lt;a href='http://www.flyatlas.org'&gt;www.flyatlas.org&lt;/a&gt; for "</span>;
        <span class="reserved">if</span> (mode == <span class="literal">"PROBE"</span>) {
    		content += <span class="literal">"probe "</span>+query;    	
        } <span class="reserved">else</span> <span class="reserved">if</span> (mode == <span class="literal">"GENE"</span>) {
        	content += <span class="literal">"gene &lt;strong&gt;"</span>+query.symbols[0]+<span class="literal">"&lt;/strong&gt;..."</span>;
        } <span class="reserved">else</span> {
            flyui.debug(<span class="literal">"should never be reached"</span>);
        	throw {message: <span class="literal">"unexpected mode: "</span>+mode};
        }
        <span class="reserved">this</span>._resultsSummaryPane.html(content);
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._renderResultsSummary"</span>, error);
    }    
}


<span class="comment">/**
 * <span class="attrib">@private</span>
 * Render the results pane.
 * <span class="attrib">@param</span> {Array&lt;flyui.flyatlas.AssayGroup&gt;} results
 */</span>
flyui.flyatlas.Widget.DefaultRenderer.<span class="reserved">prototype</span>._renderResults = <span class="reserved">function</span>( results ) {
    try {    
        var pane = <span class="reserved">this</span>._resultsPane;
        
        var content = <span class="literal">"&lt;table class='resultsTable'&gt;"</span>;
     
    <span class="comment">//    flyui.debug("generate header content");  </span>
        
        content += <span class="literal">"&lt;thead&gt;&lt;tr&gt;&lt;th&gt;probe&lt;/th&gt;&lt;th&gt;tissue&lt;/th&gt;&lt;th&gt;mRNA signal&lt;/th&gt;&lt;th&gt;present call&lt;/th&gt;&lt;th&gt;enrichment&lt;/th&gt;&lt;th&gt;affy call&lt;/th&gt;&lt;/thead&gt;"</span>;
    
        <span class="reserved">for</span> (var j=0; j&lt;results.length; j++) {
            var result = results[j];
            content += <span class="literal">"&lt;tbody&gt;"</span>;
            <span class="reserved">for</span> (var i=0; i&lt;flyui.flyatlas.tissues.length; i++) {
                var tissue = flyui.flyatlas.tissues[i];
    <span class="comment">//            flyui.debug("row for tissue "+tissue);</span>
                var assay = result[tissue];
                var classnames = <span class="literal">""</span>;
                <span class="reserved">if</span> (tissue == <span class="literal">"whole"</span>) {
                	classnames = <span class="literal">"top"</span>;
                } <span class="reserved">else</span> {
    	            <span class="reserved">if</span> (assay.change == <span class="literal">"Up"</span>) {
    	            	<span class="reserved">if</span> (assay.ratio &gt; 2) {
    		            	classnames = <span class="literal">"callUp xx"</span>;
    	            	} <span class="reserved">else</span> {
    		            	classnames = <span class="literal">"callUp x"</span>;
    	            	}
    	            } <span class="reserved">else</span> <span class="reserved">if</span> (assay.change == <span class="literal">"Down"</span>) {
    	            	<span class="reserved">if</span> (assay.ratio &lt; 0.5) {
    		            	classnames = <span class="literal">"callDown xx"</span>;
    	            	} <span class="reserved">else</span> {
    		            	classnames = <span class="literal">"callDown x"</span>;
    	            	}
    	            } <span class="reserved">else</span> {
    	            	classnames = <span class="literal">"callNone"</span>;
    	            }
                }
                content += <span class="literal">"&lt;tr class='"</span>+classnames+<span class="literal">"'&gt;"</span>;
    <span class="comment">//            content += (tissue == "whole") ? "&lt;tr class='top'&gt;" : "&lt;tr&gt;";</span>
    <span class="comment">//            flyui.debug("first cell (probe id)");</span>
                content += (tissue == <span class="literal">"whole"</span>) ? <span class="literal">"&lt;td rowspan='15'&gt;&lt;strong&gt;&lt;a href='http://flyatlas.org/probeset.cgi?name="</span>+result.affy_id+<span class="literal">"'&gt;"</span>+result.affy_id+<span class="literal">"&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;"</span> : <span class="literal">""</span> ;
    <span class="comment">//            flyui.debug("second cell (tissue)");</span>
                content += <span class="literal">"&lt;td&gt;"</span>+tissue+<span class="literal">"&lt;/td&gt;"</span> ;
    <span class="comment">//            flyui.debug("third cell (signal)");</span>
                content += <span class="literal">"&lt;td&gt;"</span>+assay.mean+<span class="literal">" ± "</span>+assay.sem+<span class="literal">"&lt;/td&gt;"</span> ;
    <span class="comment">//            flyui.debug("fourth cell (present)");</span>
                content += <span class="literal">"&lt;td&gt;"</span>+assay.present+<span class="literal">" of 4&lt;/td&gt;"</span> ;
    <span class="comment">//            flyui.debug("fifth cell (enrichment)");</span>
                content += (tissue != <span class="literal">"whole"</span>) ? <span class="literal">"&lt;td&gt;"</span>+assay.ratio+<span class="literal">"&lt;/td&gt;"</span> : <span class="literal">"&lt;td&gt; - &lt;/td&gt;"</span> ;
    <span class="comment">//            flyui.debug("sixth cell (call)");</span>
                content += (tissue != <span class="literal">"whole"</span>) ? <span class="literal">"&lt;td&gt;"</span>+assay.change+<span class="literal">"&lt;/td&gt;"</span> : <span class="literal">"&lt;td&gt; - &lt;/td&gt;"</span> ;
                content += <span class="literal">"&lt;/tr&gt;"</span>;
            }
            content += <span class="literal">"&lt;/tbody&gt;"</span>;                
        }    
        
        content += <span class="literal">"&lt;/table&gt;"</span>;
    
    <span class="comment">//    flyui.debug(content);</span>
        
        pane.append($(content));
    } catch (error) {
        throw new flyui.UnexpectedException(<span class="literal">"flyui.flyatlas.Widget.DefaultRenderer.prototype._renderResults"</span>, error);
    }    
};

</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>FlyUI</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Tue Dec  9 11:08:18 2008</div>
</body>
</html>
